package lab01;

/**
 * Created by lenovo on 2017/9/30.
 */

import java.util.Scanner;

public class Test12 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个1-9999的数");
        int num = sc.nextInt();
        int one;
        int ten;
        int hun;
        int tho;
        if (num >= 1 || num <= 9999) {          //是一个1-9999范围内的数
            one = num % 10;
            ten = num % 100 / 10;
            hun = num % 1000 / 100;
            tho = num / 1000;
            if (tho > 1 && tho <= 9) {                  //判断是一个4位数
                if (one == tho && ten == hun) {
                    System.out.println(num + "是回文");
                } else {
                    System.out.println(num + "不是回文");
                }
            } else if (tho == 0 && hun != 0) {                //判断是一个3位数
                if (hun == one) {
                    System.out.println(num + "是回文");
                } else {
                    System.out.println(num + "不是回文");
                }
            } else if (tho == 0 && (hun == 0 && ten != 0)) {            //判断是一个2位数
                if (ten == one) {
                    System.out.println(num + "是回文");
                } else {
                    System.out.println(num + "不是回文");
                }
            } else if (tho == 0 && hun == 0 && (ten == 0 && one != 0)) {
                System.out.println(num + "是回文");
            } else {
                System.out.println(num + "不在范围内");
            }
        }
    }
}
